/** @jsxImportSource @emotion/react */
import * as React from "react";
import {ReportViewProps,} from "../../common/base";
import {末尾链接, 落款单位地址,} from "../../common/rarelyVary";
import {Text, useTheme} from "customize-easy-ui-component";
import {useRepMenuDirItems} from "../../hook/useMainRepUrlOr";
import {ReportFirstPageHeadNmaNmbm} from "../../contain/rarelyVary";
import {首页设备概况PglRef} from "./rarelyVary";
import {ConclusionglRefVw, 结论报告盖章} from "./ConclusionglRef";
import {CertificatePage, } from "./CertificatePage";
import {目录页VS} from "../../movable/rarelyVary";
import {useItemsMapPressure} from "../../common/pressure";
import {注意事项glRef} from "../../furnace/glReform/rarelyVary";

//contlist有却多数没找到模板！
export const VsProjects默认=[
    {name:'监督检验结论报告',ml:'电站锅炉改造和重大修理监督检验结论报告',ha:'Conclusion', do:true},
    {name:'监检工作综述',ml:'施工情况及监检工作综述报告',ha:'', },
    {name:'单位资源条件审查',ml:'改造、修理单位资源条件审查报告',ha:'', },
    {name:'工艺文件审查报告',ha:'', },
    {name:'施工质量监督',ml:'施工过程及施工质量监督检验报告',ha:'', },
    // {name: '耐压试验报告', ha: 'rp_pressure_'},
    {name:'水（耐）压试验',ml:'锅炉水（耐）压试验现场监督报告',ha:'', },
    {name:'竣工资料审查报告',ha:'', },
    {name:'附页（检验联络单）',ml:'附页（检验联络单及意见书反馈情况）',ha:'', },
];

export const ReportView: React.FunctionComponent<ReportViewProps> = ({
    repId,   source: orc,  verId,rep,
}) => {
    const theme= useTheme();
    const [mapFxian]=useItemsMapPressure({ projects:orc.Projects });
    // const {storage, setStorage} =React.useContext(EditStorageContext) as any;
    const [rootMenu]=useRepMenuDirItems(VsProjects默认, orc.Projects, `/reportView/${rep?.modeltype}/ver/${verId}/${repId}`);
  return (
    <React.Fragment>
        {rootMenu}
        <div css={{"@media not print": {marginTop: '1rem', marginBottom: '1rem'}}}>
            { orc?.检验结论==='符合要求' &&
                <CertificatePage orc={orc} rep={rep}/>
            }
            <div css={{
                display: 'flex',
                flexDirection: 'column',
                justifyContent: 'space-between',
                "@media print": {height: '100vh', pageBreakInside: 'avoid',}
            }}>
                {ReportFirstPageHeadNmaNmbm({theme, rep,nofbp:true, mbbm: 'FJB/TM-1007-1-0-2022'})}
                <div>
                    <Text variant="h3" css={{
                        textAlign: 'center',
                        "@media (min-width:690px),print and (min-width:538px)": {
                            fontSize: theme.fontSizes[6],
                        }
                    }}>
                      电站锅炉修理改造监督检验报告
                    </Text>
                    <br css={{"@media not print": {display: 'none'}}}/>
                    <Text variant="h5" css={{textAlign: 'center',}}> （ FJB/GB-1009-0-2021 ）</Text>
                </div>
                <div>
                  {首页设备概况PglRef({theme, orc, rep})}
                </div>
                <div css={{textAlign: 'center', "@media print": {pageBreakInside: 'avoid'}}}>
                    {落款单位地址}
                </div>
            </div>
            {注意事项glRef({
                rep,
                comply: '书为依据《锅炉安全技术规程》TSG 11-2020制定，适用于电站锅炉改造和重大修理监督检验报告的结论报告'
            })}

            {!orc?._MlnDisplay && 目录页VS({theme, orc, rep}) }
            <ConclusionglRefVw orc={orc} rep={rep}/>
            {结论报告盖章({theme, orc, rep})}

            {mapFxian.get('监检工作综述')?.do && <h2>模板还未做的分项</h2>}
            {mapFxian.get('单位资源条件审查')?.do && <h2>模板还未做的分项</h2>}
            {mapFxian.get('工艺文件审查报告')?.do && <h2>模板还未做的分项</h2>}
            {mapFxian.get('施工质量监督')?.do && <h2>模板还未做的分项</h2>}
            {mapFxian.get('水（耐）压试验')?.do && <h2>模板还未做的分项</h2>}
            {mapFxian.get('竣工资料审查报告')?.do && <h2>模板还未做的分项</h2>}
            {mapFxian.get('附页（检验联络单）')?.do && <h2>模板还未做的分项</h2>}
        </div>
        {末尾链接({template: rep?.modeltype, verId, repId: repId || ''})}
    </React.Fragment>
  );
}
